<template>
  <a-divider>常规属性</a-divider>
  <a-form
    :model="element"
    :label-col="{ span: 10 }"
    :wrapper-col="{ span: 14 }"
    autocomplete="off"
    labelAlign="left"
  >
    <a-form-item label="隐藏" name="hidden" >
      <a-switch v-model:checked="element.options.hidden" />
    </a-form-item>
    <div class="event_list">
      <div class="event_item">
        <div class="title">编辑HTML</div>
        <a-button type="default" shape="round" size="small" @click="() => openEditor()">
          <a-icon name="EditOutlined" />
          编辑HTML
        </a-button>
      </div>
    </div>
  </a-form>
  <codeEditor v-model="element.options.content" v-model:open="open" title="编辑HTML" :show-alert="false" />
</template>

<script setup>
import { inject, reactive, ref } from 'vue'
import codeEditor from '@/components/code-editor/code-editor.vue';

const WidgetData = inject('$WidgetData')
const element = reactive(WidgetData.find(WidgetData.selectKey))

const open = ref(false)
const openEditor = () => {
  open.value = true
}
</script>

<style lang="less" scoped>
.event_list{
  .event_item{
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 80%;
    margin-bottom: 16px;
    .title{
      font-size: 13px;
      overflow: hidden;
      white-space: nowrap;
    }
  }
}
</style>
